package com.myprocessing.box.button;

import processing.core.PConstants;

import com.myprocessing.box.TextBox;
import com.myprocessing.gui.util.Coord;
import com.myprocessing.gui.util.Font;

public class SimpleTextButton extends Button {
	
	protected TextBox textBox;
	protected String label;
	protected Font font;
	protected float lineHeight = 12;
	
	public void init() {
		textBox = new TextBox(font, label, lineHeight, PConstants.CENTER,
				PConstants.CENTER);
		textBox.setSize(new Coord(size));
		textBox.setPosition(new Coord(0,0));
		addSubBox(textBox);
		super.init();
	}

	public TextBox getTextBox() {
		return textBox;
	}

	public void setTextBox(TextBox textBox) {
		this.textBox = textBox;
	}
	
	public void drawBox() {		
		if (hasMouseOver) {
			pApplet.fill(100);
			pApplet.stroke(0);
		}
		else {
			pApplet.fill(85);
			pApplet.stroke(15);
		}
		pApplet.rect(0, 0, size.getX(), size.getY());
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public Font getFont() {
		return font;
	}

	public void setFont(Font font) {
		this.font = font;
	}

	public float getLineHeight() {
		return lineHeight;
	}

	public void setLineHeight(float lineHeight) {
		this.lineHeight = lineHeight;
	}

}
